gtk: Fix warnings for some uses of GtkLinkButton
authorBastien Nocera <hadess@hadess.net>
Thu, 10 May 2012 14:15:43 +0000 (15:15 +0100)
committerBastien Nocera <hadess@hadess.net>
Thu, 10 May 2012 14:22:31 +0000 (15:22 +0100)
Not setting a URI but catching the activate-link signal is a
valid use of GtkLinkButton, but we shouldn't allow showing a
popup menu which offers to copy the URI if there's none.

gtk/gtklinkbutton.c

index 15a52f6a85fe5a7a354ef7f29c9440bf30b883ad..b5981c741f5ea55192dd40ddbeb9d8fb5e7b5f94 100644 (file)
@@ -526,7 +526,10 @@ gtk_link_button_button_press (GtkWidget      *widget,
   if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
 
-  if (gdk_event_triggers_context_menu ((GdkEvent *) event))
+  /* Don't popup the menu if there's no URI set,
+   * otherwise the menu item will trigger a warning */
+  if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
+      GTK_LINK_BUTTON (widget)->priv->uri != NULL)
     {
       gtk_link_button_do_popup (GTK_LINK_BUTTON (widget), event);